
const data=[{"depth":0,"text":" 发达的沙发fadfadsfasdfa"},{"depth":0,"text":"发大水发"},{"depth":1,"text":"法师法师法师"},{"depth":1,"text":"发生的发生的"},{"depth":0,"text":" 发达的沙发fadfadsfasdfa"},{"depth":0,"text":"发大水发"},{"depth":1,"text":"法师法师法师"},{"depth":1,"text":"法师法师法师"},{"depth":1,"text":"发生的发生的"}];



import React, { Component, PropTypes } from 'react';
import { connect } from 'dva';

function IndexPage() {
  let depth = 0;
  const olElement=[];
  let deptholElement= [];
  let first = false;
  data.forEach(item => {
    if(item.depth === 0){
      if(first){
        olElement.push(<ul>{deptholElement}</ul>);
        deptholElement = [];
        first = false;
      }
      olElement.push(<ol>{item.text}</ol>);

    }
    if(item.depth === 1)
    {
      first = true;
      deptholElement.push(<ol>{item.text}</ol>)
    }
  })
  if(first) {
     olElement.push(<ul>{deptholElement}</ul>)
  }
  return (<ul>{olElement}</ul>)
}


IndexPage.propTypes = {
};

export default connect()(IndexPage);
